package com.leng.Context;

import com.leng.entity.Buiding;
import com.leng.service.BuidingService;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.annotation.Resource;
import java.util.List;

/**
 * @Author: 冷俊杰
 * @Description: TODO
 * @DateTime: 2022/7/18 16:31
 **/
@Controller
public class BuidingContext {
    @Resource
    BuidingService buidingService;

    @RequestMapping("/selbuiding")
    public ModelAndView listBuiding(){
        ModelAndView modelAndView = new ModelAndView();
        List<Buiding> buidings = buidingService.listBuiding();
        modelAndView.setViewName("add");
        modelAndView.addObject("buidings",buidings);
        return modelAndView;
    }
}
